title: calculating pagination offset of specific row/offset
body: <p>there is a function for showing posts 
  (pleas ignore syntax errors  )</p>
  
  <pre><code>function get_all_posts ($offset = 0 )
  {
    $q =  $db-&gt;query("select * from tbl limit 10 offset $offset ");
    $template-&gt;load_view('posts' , $q ); 
  }
  </code></pre>
  
  <p>now lets say i have function called <code>get_one_post</code> with a single post offset and total posts count as argument </p>
  
  <pre><code>function get_one_post($requested_post_offset = 0 , $totl_posts_count = 0 )
  {
  
  }
  </code></pre>
  
  <p>basically what i want to do in this <code>get_one_post</code> is to calculate page offset of requested_post and call <code>get_all_posts</code> function , so it show the page that contains that specific post </p>
  
  <pre><code>function get_one_post($requested_post_offset = 0 , $totl_posts_count = 0 )
  {
     $page_offset = // calculation( $requested_post_offset , $totl_posts_count );
     get_all_posts ($page_offset);
  
  }
  </code></pre>
  
  <p>i can say</p>
  
  <pre><code> get_all_posts ($requested_post_offset );
  </code></pre>
  
  <p>but it shows requested post as first post in the page ... but i wan to be in it's natural place in the pagination not the first one </p>
  
  <p>how should i do the <code>calculation</code> part ? </p>
  
  <p>---------------------------------EDIT----------------------------</p>
  
  <p>please note that i know how to create and implement pagination ... that's not the issue here 
  my framework pagination system works with offsets instead of page numbers ..
  like if per_page is 10 , pagination links would be like </p>
  
  <pre><code>page 1  =&gt; page.php?offset=0
  page 2  =&gt; page.php?offset=10
  page 3  =&gt; page.php?offset=20
  </code></pre>
  
  <p>in this example if the <code>$requested_post_offset</code> is 15 then 
  THE PAGE OFFSET IS 10 
   and i should get the result of </p>
  
  <pre><code>page 2  =&gt; page.php?offset=10
  </code></pre>