title: Pagination calculation (Result Per page calculation after sorting)
body: <p>I'm trying to develop pagination, and I'll need to figure out how to limit my result set by item offset. I managed to implement the start, end, and total page count in some way. However, when I sort the product data, the start, end, and total page count values remain the same.</p>
  <p>eg.</p>
  <blockquote>
  <p>before sorted -&gt;   Showing 1 to 10 of 60 ( 6 pages)</p>
  <p>after sorted -&gt;  Showing 1 to 10 of 0 ( 0 pages)</p>
  </blockquote>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="true">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const totalProductCount = 60
  const resultPerPage = 10
  const currentPageNumber = 1
  const totalPageCount = Math.round(totalProductCount / resultPerPage)
  const from = parseInt((currentPageNumber - 1) * resultPerPage) + 1
  const to = parseInt(currentPage * resultPerPage)
  
  console.log(Showing {from} to {to} of {totalProductsCount} ({totalPageCount} Pages))
  
  // Showing 1 to 10 of 60 ( 6 pages)</code></pre>
  </div>
  </div>
  </p>
  <p>However, after the data is sorted, the totalProducts count falls to 0, and the result remains the same.</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="true">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const totalProductCount = 0
  const resultPerPage = 10
  const currentPageNumber = 1
  const totalPageCount = Math.round(totalProductCount / resultPerPage)
  const from = parseInt((currentPageNumber - 1) * resultPerPage) + 1
  const to = parseInt(currentPage * resultPerPage)
  
  console.log(Showing {from} to {to} of {totalProductsCount} ({totalPageCount} Pages))
  
  // Showing 1 to 10 of 0 ( 0 pages) // still same</code></pre>
  </div>
  </div>
  </p>