Fix redirect on paginated search results

Fixes #6281