Your problem might be related to 5
. The previous_posts_link
only accepts one valid parameter, and that is $label
, you are passing two.
Secondly, the next_posts_link
does accept the second parameter $max_pages
. Here you ara passing a value of 5, which overrides $wp_query->max_num_pages
. So you are telling WordPress there are 5 pages, regardless of the real amount of pages.
SOLUTION:
Simply remove 5
from your links, that should solve your problem