As for determining which page you are on, you can reference the CurrentPage property. This is a good way to determine which way to go:
Also, I recommend handling the NextClicked event and using the NextPageToLoad event argument and/or CancelNavigation method. Below is a sample usage.