Commit:    bd8fdb6f3a0b4e077895a39cc9e49c6661508773
Author:    Peter Cowburn <[email protected]>         Wed, 7 Aug 2019 20:15:15 
+0100
Parents:   f421358a65a1c424d0e21970171721c806f524a7
Branches:  master

Link:       
http://git.php.net/?p=web/people.git;a=commitdiff;h=bd8fdb6f3a0b4e077895a39cc9e49c6661508773

Log:
fix offset for user listing pagination

Previously, the first 50 users in the list from master could not be
accessed.  This is because page numbers start at 1 (see $page in
index.php), meaning the array_slice() offset lowest value is 50 instead
of 0.

Changed paths:
  M  include/misc.php


Diff:
diff --git a/include/misc.php b/include/misc.php
index 36cfa71..fd51c0a 100644
--- a/include/misc.php
+++ b/include/misc.php
@@ -15,7 +15,7 @@ function getDOMNodeFrom($url, $nodename)
     return $search->item(0);
 }
 
-function findAllUsers($batch) {
+function findAllUsers($page) {
     $opts = array("ignore_errors" => true);
     $ctx = stream_context_create(array("http" => $opts));
     $token = getenv("TOKEN");
@@ -32,8 +32,8 @@ function findAllUsers($batch) {
         error($json["error"]);
     }
 
-    $batch *= 50;
-    return array_slice($json, $batch, 50);
+    $offset = ($page - 1) * 50;
+    return array_slice($json, $offset, 50);
 }
 function findPHPUser($username)
 {


--
PHP Webmaster List Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to