add pagination
only add pagination if greater than max per page