Correctly generate pagination links when using AJAX and search terms have been set.
Also improve pagination support for main loops in the Groups/Members/Messages components when JS is disabled.

Fixes #5768, props r-a-y

git-svn-id: https://buddypress.svn.wordpress.org/trunk@8931 cdf35c40-ae34-48e0-9cc9-0c9da1808c22