ensure correct page number is generated for next and previous page