add function to validate the page number.