Ajax pager failure in view after modifying view on hook_views_query_alter
When the view query is being called from inside the pager, the requesting URL is different. It becomes: '/views/ajax'. This URL does not match any that had been specified in my context, so no results were returned.

I solved the problem by checking if the query view is being called within the pager -- i.e. if $_SERVER["REQUEST_URI"] == '/views/ajax'. If so, then I extract the correct path instead from $_SERVER["HTTP_REFERER"]. If not, then it's okay to accept the path from $_SERVER["REQUEST_URI"].