Fix pagination on collections and patterns controller