My question is: if the current page is, say, the first in the collection ('Antelope'), how can I add a rule so that prev links to the last page in the collection (say, 'West Highland Terrier')? And vice versa.
I think you want to create some circular looping through siblings. I don't know your use-case, but I'm afraid this is confusing to the end-user. When will the end-user come to the conclusion that he/she is looping?
It might be that pagination might throw of the first and last item in the collection. Just try and see what happens.
I think you want to create some circular looping through siblings. I don’t know your use-case, but I’m afraid this is confusing to the end-user. When will the end-user come to the conclusion that he/she is looping?
You are right to raise the issue. In this case the correct succession of pages is not meaningful or important, so it's more about providing a convenient navigation.
It might be that pagination might throw of the first and last item in the collection. Just try and see what happens.