Fixed pagination not working for non-root pages.