Move pagination to utils/pagination. Refs #837, #835.