How to work with $_SERVER['QUERY_STRING']
<p>How to work with $_SERVER['QUERY_STRING'] and pagination?</p>

<p>When my table is sorted by this link:</p>

<pre><code>&lt;a href="'.$_SERVER['PHP_SELF'].'?sort_name=name&amp;sort=asc" title="'.$lang['sorteer_asc'].'"&gt;&lt;/a&gt;
</code></pre>

<p>My url becomes: relation.php?sort_name=adres&amp;sort=asc</p>

<p>The I use an pagination link:</p>

<pre><code>echo '&lt;a href="'.$_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'].'&amp;page='.$i.'"&gt;'.$i.'&lt;/a&gt; '; 
</code></pre>

<p>And the url becomes: relation.php?sort_name=adres&amp;sort=asc&amp;page=2</p>

<p>So far so good but when browsing to other pages it can be as long as:
relation.php?sort_name=adres&amp;sort=asc&amp;page=2&amp;page=3&amp;page=14&amp;page=23&amp;page=27</p>

<p>The age keeps appearing because of the $_SERVER['QUERY_STRING'], how can I clean up my url with only keeping the last page and ?sort_name=adres&amp;sort=asc.</p>

<p>Or do you suggest an other solution of ordering and pagination?</p>
