title: Pagination list from array
body: <p>Hi from sql i take array and create product list. It is currently displaying a list to me, but I want to limit the number of display items and use pagination. I created the code but clicking next does not show the next items. Changes the link to domain.com/name/2 but the items are still the same. When I am on domain.com/name/2 click next does not move to domain.com/name/3 and stays on domain.com/name/2, additionally on domain.com/name/2 the previous button is not shown. My link to page is domain.com/name/ maybe here is the problem? I will be grateful for your help</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php
  
  $page = $_GET['page'];
  if (empty($page) || is_numeric($page) == FALSE) {
    $page = 1;
  }
  else {
    $page = $_GET['page'];
  }
  $items = 2;
  $offset = ($page * $items) - $items;
  
  global $wpdb;
  $table = "items";
  $names = $wpdb-&gt;get_col("SELECT Name FROM $table LIMIT $items OFFSET $offset");
  $numbers = $wpdb-&gt;get_col("SELECT Number_it FROM $table LIMIT $items OFFSET $offset");
  
  foreach (array_combine($numbers, $names) as $number =&gt; $name )
  {
   echo '&lt;p&gt;'.$name.' &lt;a href="name.php?product='.$number.'"&gt;'.$number.'&lt;/a&gt;&lt;/p&gt;';
  };
  ?&gt;
  
  &lt;a href="domain.com/name/?page=&lt;?php echo $page + 1; ?&gt;"&gt;Next Page&lt;/a&gt;
  &lt;?php if ($page != 1) { ?&gt;
  &lt;a href="domain.com/name/?page=&lt;?php echo $page - 1; ?&gt;"&gt;Previous Page&lt;/a&gt;
  &lt;?php } ?&gt;</code></pre>
  </div>
  </div>
  </p>