refactored common pagination garbage to a controller "mixin"