+1  A: 

it's simple:

  1. don't use $_SERVER['argv'][0], construct URL by yourself on every request.
  2. use preg_replace to remove existing page variable from $_SERVER['argv'][0] then add new one:

    $url_without_page_var=preg_replace('/page=(\d+)/i','',$_SERVER['argv'][0]);

Sergei
Thank you so much I have had to live with this bug in my code for over a year now, it works perfect
jasondavis