avoid blindly triggering switchToPage event, we check whether the page number is changed or not