title: Limit pagination page number
body: <pre><code>$objConnect = mysql_connect("localhost","root","") or die(mysql_error());
  $objDB = mysql_select_db("Test");
  
  $strSQL = "SELECT * FROM UserAddedRecord WHERE (Name LIKE '%".$getname."%' and State LIKE '%".$getstate."%' and Cell LIKE '%".$getcell."%' and Custgroup LIKE '%".$getgroup."%') AND user_id=$id";
  
  $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
  $Num_Rows = mysql_num_rows($objQuery);
  
  $Per_Page = 5;   
  
  if (!isset($_GET['Page'])) {
      $Page = 1;
  } else {
      $Page = $_GET['Page'];
  }
  
  $Prev_Page = $Page - 1;
  $Next_Page = $Page + 1;
  
  $Page_Start = (($Per_Page * $Page) - $Per_Page);
  if ($Num_Rows &lt;= $Per_Page) {
      $Num_Pages = 1;
  } elseif (($Num_Rows % $Per_Page) == 0) {
      $Num_Pages = ($Num_Rows / $Per_Page) ;
  } else {
      $Num_Pages = ($Num_Rows / $Per_Page) + 1;
      $Num_Pages = (int) $Num_Pages;
  }
  
  
  $strSQL .=" order  by addedrec_ID DESC LIMIT $Page_Start , $Per_Page";
  $objQuery  = mysql_query($strSQL) or trigger_error(mysql_error());;
  
  if ($Prev_Page) {
      echo " &lt;a href ='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page&amp;txtName=$getname&amp;txtState=$getstate&amp;txtCell=$getcell&amp;txtGroup=$getgroup'&gt;&lt;&lt; Back&lt;/a&gt; ";
  }
  
  for ($i=1; $i &lt;= $Num_Pages; $i++) {
      if ($i != $Page) {
          echo " &lt;a href ='$_SERVER[SCRIPT_NAME]?Page=$i&amp;txtName=$getname&amp;txtState=$getstate&amp;txtCell=$getcell&amp;txtGroup=$getgroup'&gt;$i&lt;/a&gt; ";
      } else {
          echo "&lt;b&gt; $i &lt;/b&gt;"; 
      }
  }
  
  if ($Page!=$Num_Pages) {
      echo " &lt;a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page&amp;txtName=$getname&amp;txtState=$getstate&amp;txtCell=$getcell&amp;txtGroup=$getgroup'&gt;Next&gt;&gt;&lt;/a&gt; ";        
  }
  
  mysql_close($objConnect);
  </code></pre>
  
  <p>This is the code I use to create pagination page for data search.But I just noticed that I have too many records then it will have too many page numbers.I'm trying to limit the page number shown,and look for many examples ..it have many ways to do it but I still don't have idea how to limit it for my method...</p>