title: PHP how to hide some of page numbers?
body: <p>I want to ask how i can hide some of the page numbers on the result page so they show like this:</p>
  
  <pre><code>[First] [Back] [1] [2] [3] [4] [5] ..... [10] [11] [12] [13] [14] [15] [Next] [Show Last]
  </code></pre>
  
  <p>Now it's showing like this:</p>
  
  <pre><code>[1] [2] [3] [4] [5] [6] [7] [8] [8] [10] [11] [12] [13] [14] [15]
  </code></pre>
  
  <p>But i don't want that. I want to make them show like in the first example.</p>
  
  <p>Here is the code that i use for making the results in pages :</p>
  
  <pre><code>&lt;?PHP
  $requested_page = isset($_GET['page']) ? intval($_GET['page']) : 1;
  
  // Get the product count
  $r = mysql_query("SELECT COUNT(*) FROM `oferts`");
  $d = mysql_fetch_row($r);
  $product_count = $d[0];
  
  $products_per_page = 20;
  
  // 55 products =&gt; $page_count = 3
  $page_count = ceil($product_count / $products_per_page);
  
  // You can check if $requested_page is &gt; to $page_count OR &lt; 1,
  // and redirect to the page one.
  
  $first_product_shown = ($requested_page - 1) * $products_per_page;
  
  
  
  // Then we retrieve the data for this requested page
  $r = mysql_query("SELECT * FROM `oferts` ORDER BY id DESC LIMIT $first_product_shown, $products_per_page ");
  
      while($rowi = mysql_fetch_array($r))
                  {
                  $title = addslashes($rowi['title']);
                  $fromweb = addslashes($rowi['fromweb']);
                  $image = addslashes($rowi['image']);
                  $link = addslashes($rowi['link']);
                  $price = addslashes($rowi['price']);
                  $realprice = addslashes($rowi['realprice']);
                  $endDate = addslashes($rowi['endDate']);
                  $calc = $realprice / $price;
                  if ($realprice == 0)
                  {
                  $procent = 0;
                  }
                  if ($realprice != 0)
                  {
                  $percent = 100/$calc;
                  $reshenie = 100-$percent;
                  $procent = substr($reshenie,0,2);
                  }
                  if ($fromweb == '1') {
                  $divname = "ozo";
                  }
                  if ($fromweb == '2') {
                  $divname = "vip";
                  }               
                  $seconds = strtotime("$endDate") - time();
  
                  $days = floor($seconds / 86400);
                  $seconds %= 86400;
  
                  $hours = floor($seconds / 3600);
                  $seconds %= 3600;
  
                  $minutes = floor($seconds / 60);
                  $seconds %= 60;
  
                  $position=65;
                  $titleNumbered = mb_substr($title, 0, $position, "utf-8");
  
                  $healthy = array('\"');
                  $yummy   = array('');
  
                  $TitleText = str_replace($healthy, $yummy, $titleNumbered);
                  ?&gt;
  &lt;div class="OfferBox"&gt;
  &lt;center&gt;
      &lt;div class="&lt;?PHP echo $divname;?&gt;"&gt;&lt;/div&gt;
      &lt;a href="&lt;?PHP echo $link;?&gt;" target="_blank"&gt;&lt;img src="&lt;?PHP echo $image;?&gt;" style="width:190px;border:1px solid #E5E5E5;"/&gt;&lt;/a&gt;
      &lt;div class="OfferText"&gt;&lt;?PHP echo "$TitleText...";?&gt;&lt;/div&gt;
      &lt;div class="p1"&gt;&lt;b&gt;&lt;?PHP echo $realprice;?&gt;лв.&lt;/b&gt;&lt;/div&gt;&lt;div class="p2"&gt;&lt;b&gt;-&lt;?PHP echo $procent;?&gt;%&lt;/b&gt;&lt;/div&gt;&lt;div class="p3"&gt;&lt;b&gt;&lt;?PHP echo $price;?&gt;лв.&lt;/b&gt;&lt;/div&gt;
      &lt;a href="&lt;?PHP echo $link;?&gt;" class="OfferButton" target="_blank"&gt;&lt;/a&gt;
      &lt;div class="timeleft"&gt;Изтича след:&lt;br&gt;&lt;?PHP echo "$days дни | $hours часа | $minutes мин.";?&gt;&lt;/div&gt;
  &lt;/center&gt;   
  &lt;/div&gt;
  &lt;?PHP
  }
  ?&gt;
  &lt;/div&gt;
  &lt;?PHP
  echo '&lt;div style="clear:both;display:block;bottom:0;float:right;margin-right:20px;"&gt;';
  for($i=1; $i&lt;=$page_count; $i++) {
      if($i == $requested_page) {
          echo "&lt;span class='pagenumberSelected'&gt;&lt;b&gt;$i&lt;/b&gt;&lt;/span&gt; ";
      } else {
          echo '&lt;a href="index.php?page='.$i.'" class="pagenumber"&gt;&lt;b&gt;'.$i.'&lt;/b&gt;&lt;/a&gt; ';
      }
  }
  echo '&lt;/div&gt;&lt;br&gt;';
  ?&gt;
  </code></pre>
  
  <p>So how i can make it?
  How i can hide some of the page numbers when they are more?</p>