Fix pager when close to the end of the number of pages.