Extracted paginate_per_page helper for crudify from complex logic.