Wrong urls printed for small subset using getNext and getPrev
I believe I already answered this in the OP's other, similar question, but:

You shouldn't pass a string value (i.e. 'posts') to getNext() and getPrev() – those methods expect either an ElementCriteriaModel instance, or an object with attributes representing a query (i.e. something like { section: 'posts' }.

What actually happens when you call entry.getPrev('posts'), is that Craft will just ignore the string value (I'm guessing 'posts' is a section handle, but there's no way for Craft to know that), and you're probably going to get an EntryModel back, but it won't reliably be from the same section as your current entry – it can be an entry from any section in your system, which is probably where your problem is.

So here's how your code should probably look:

{% set criteria = { section: 'posts' } %}
{% set prev = entry.getPrev(criteria) %}
{% set next = entry.getNext(criteria) %}


You can also include other attributes, like for example order (otherwise, default attributes will apply, such as postDate desc for a Channel section, or structure for a Structure):

{% set criteria = { section: 'posts', order: 'title asc' } %}
{% set prev = entry.getPrev(criteria) %}
...


...and of course, you can make the criteria dynamic:

{% set criteria = { section: entry.section } %}
{% set prev = entry.getPrev(criteria) %}
...


Finally, make sure to always wrap the returned values from getNext() and getPrev() in a conditional – you can't always be sure that there'll be a valid "next" or "previous" element for any given entry, so this avoids template errors:

{% set prev = entry.getPrev(criteria) %}
...
{% if prev %}
    &lt;a href="{{ prev.url }}"&gt;{{ prev.title }}&lt;/a&gt;
{% endif %}


Of course, it's possible to declare a fallback value whenever there isn't a next or previous element:

{% set next = entry.getNext(criteria) ?? craft.entries(criteria).first() %}