Fix for pagenav

Fixes some links being active when they should not. Still need to fix
the for loop creating page links