Fix link to all pages in pagination

Page 1 links on index pages don't always work properly. (i.e., they sometimes link back to the front rather than the first page of the index page.) This fixes that.