Fix pagination

Fix pagination and make it uniform across the application.