Pagination producing wrong links