fixing centerCurrentPage when totalPages - numberOfPages is negative