Update pages after totalPages is updated