Fix to ensure prev and next links in pagination remain