Fix the bug that negative page numbers will be generated when total page is 4.