If you observe carefully, the styles of the buttons for an active page is different from that of the pages that aren’t active.
If the current page is active, it’s button becomes a SPAN element, and the clickable buttons become ‘A’ elements.
Therefore, you have to check for the SPAN element. If you find it, then it means that you are on the currently active page. You can use this to ask the robot to look for a A element with the value equal to the next page number.
Example: When Work Items load, the button 1 is by default active and will be a SPAN element
You can then use that decision to look for an element that is an A element with a value = 2
It’s a good challenge to solve if you make use of the UI Explorer and click on an the different styles of the buttons and compare their selectors and then use them in the Find Element activity.