Recalculate the number of items per page