title: jQuery dataTables server side pagination counter is wrong
body: <p>I am trying to display 2 items per page but when I checked the &quot;Next&quot; button it is disabled and the pagination counter is only 1. Here is a screenshot:</p>
  <p><a href="https://i.stack.imgur.com/wNAd2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wNAd2.png" alt="enter image description here" /></a></p>
  <p>I only have 3 items in my database record and I tried to display 2 items per page. So the Pagination counter should say <code>2</code> and the Next button should not be disabled.</p>
  <p>This is my code:</p>
  <pre><code>    $('#transactions').DataTable({
              dom: 'Bfrtip',
              &quot;processing&quot; : true,
              &quot;serverSide&quot; : true,
              &quot;ajax&quot; : {
                  url: &quot;/reports/ajax-overall&quot;,
                  dataSrc: function(json){
                      json['recordsTotal'] = json.total;
                      json['recordsFiltered'] = json.per_page;
                      json['draw'] = 1;
  //                    return json;
                      return json.data;
                  }
              },
              &quot;columns&quot;: [
                  { &quot;data&quot;: &quot;created_at&quot; },
                  { &quot;data&quot;: &quot;order_number&quot; },
                  { &quot;data&quot;: &quot;customer_name&quot; },
                  { &quot;data&quot;: &quot;payment_method&quot; },
                  { &quot;data&quot;: &quot;discount&quot; },
                  { &quot;data&quot;: &quot;tax&quot; },
                  { &quot;data&quot;: &quot;total_payable_amount&quot; },
                  { &quot;data&quot;: &quot;customer_paid_amount&quot; },
                  { &quot;data&quot; : &quot;&quot; }
              ],
              &quot;columnDefs&quot; : [
                  {
                      &quot;render&quot; : function(data,type,row){
                          console.log(row.id);
                          return &quot;&lt;a href='#' class='view-order-details' id='order-details-&quot;+row.id+&quot;'&gt;View Order Details&lt;/a&gt;&quot;;
                      },
                      &quot;targets&quot; : 8
                  },
                  {
                      &quot;render&quot; : function(data,type,row){
                          let total = row.total_payable_amount;
                          total = parseFloat(total);
                          total = total.toFixed(2);
                          return numberWithCommas(total);
                      },
                      &quot;targets&quot; : 6
                  },
                  {
                      &quot;render&quot; : function(data,type,row){
                          let paid_amount = row.customer_paid_amount;
                          paid_amount = parseFloat(paid_amount);
                          paid_amount = paid_amount.toFixed(2);
                          return numberWithCommas(paid_amount);
                      },
                      &quot;targets&quot; : 7
                  }
              ],
              buttons: [
                  {
                      extend: 'pdf',
                      footer: false,
                      exportOptions: {
                          columns: &quot;thead th:not(.noExport)&quot;
                      }
                  },
                  {
                      extend: 'csv',
                      footer: false,
                      exportOptions: {
                          columns: &quot;thead th:not(.noExport)&quot;
                      }
                  },
                  {
                      extend: 'excel',
                      footer: false,
                      exportOptions: {
                          columns: &quot;thead th:not(.noExport)&quot;
                      }
                  }
              ]
          });
  </code></pre>
  <p>Here is a sample response from the server:</p>
  <pre><code>{
      &quot;current_page&quot;: 1,
      &quot;data&quot;: [
          {
              &quot;id&quot;: 2,
              &quot;created_at&quot;: &quot;2017-10-01 15:34:30&quot;,
              &quot;order_number&quot;: &quot;1001&quot;,
              &quot;payment_method&quot;: &quot;Cash&quot;,
              &quot;customer_name&quot;: &quot;Michael Jordan&quot;,
              &quot;total_payable_amount&quot;: &quot;1250.0000&quot;,
              &quot;total&quot;: &quot;1250.0000&quot;,
              &quot;discount&quot;: null,
              &quot;tax&quot;: null,
              &quot;customer_paid_amount&quot;: &quot;1500.0000&quot;
          },
          {
              &quot;id&quot;: 3,
              &quot;created_at&quot;: &quot;2017-10-01 14:38:47&quot;,
              &quot;order_number&quot;: &quot;1002&quot;,
              &quot;payment_method&quot;: &quot;Cash&quot;,
              &quot;customer_name&quot;: &quot;Kobe Bryant&quot;,
              &quot;total_payable_amount&quot;: &quot;1250.0000&quot;,
              &quot;total&quot;: &quot;1250.0000&quot;,
              &quot;discount&quot;: null,
              &quot;tax&quot;: null,
              &quot;customer_paid_amount&quot;: &quot;1500.0000&quot;
          }
      ],
      &quot;from&quot;: 1,
      &quot;last_page&quot;: 2,
      &quot;next_page_url&quot;: &quot;http://127.0.0.1:8080/api/reports/all/2017-10-01/2017-10-01?page=2&quot;,
      &quot;path&quot;: &quot;http://127.0.0.1:8080/api/reports/all/2017-10-01/2017-10-01&quot;,
      &quot;per_page&quot;: 2,
      &quot;prev_page_url&quot;: null,
      &quot;to&quot;: 2,
      &quot;total&quot;: 3
  }
  </code></pre>
  <p>Here's my Laravel Code:</p>
  <pre><code>$orders = DB::table(&quot;orders&quot;)
          -&gt;select(
              &quot;orders.id&quot;,
              &quot;orders.created_at&quot;,
              &quot;orders.order_number&quot;,
              &quot;order_payments.payment_method&quot;,
              &quot;order_payments.customer_name&quot;,
              &quot;order_payments.total_payable_amount&quot;,
              &quot;order_payments.total&quot;,
              &quot;order_payments.discount&quot;,
              &quot;order_payments.tax&quot;,
              &quot;order_payments.customer_paid_amount&quot;
          )
          -&gt;leftJoin(&quot;order_payments&quot;,&quot;order_payments.order_id&quot;,&quot;=&quot;,&quot;orders.id&quot;)
          -&gt;where('orders.created_at','&gt;=',$start_date)
          -&gt;where('orders.created_at','&lt;=',$end_date)
          -&gt;where(&quot;orders.has_paid&quot;,&quot;=&quot;,$has_paid)
          -&gt;paginate(2);
      return $orders;
  </code></pre>
  <p>Am I missing something here?</p>
  <p>Thanks.</p>