Instead of reusing QUERY_STRING, you should assemble it anew with http_build_query().
// Merge $_GET with new parameter
$QS = http_build_query(array_merge($_GET, array("page"=>2)));
// You should apply htmlspecialchars() on the path prior outputting:
echo " $i ";
Thus you have all current $_GET parameters included, but can add or replace entries with new values. And it's ensured that each appears only once.