pagination: moved variables from service to controller. fixed routing.