Check next and previous page which template is in use

Check out this solution: Navigate into a collection with hasNext/hasPrev

By default, you can’t pass a collection to the prev() and next() methods.