login/list: hide unvisited if ordered by seen
[minimedit.git] / login / list.php
index 1f049d84494fc84eb59323cae6e97ddaa47801dc..edf9ee63273a2f76a174e2c1140aaa7e35bafc69 100644 (file)
@@ -12,13 +12,18 @@ if (@$Place['order'] == 'seen') {
        $order = array_map(function ($col) { return $col->seen; }, $users);
 #      $order = array_column($users, 'seen');  #TODO php7 simplification
        array_multisort($order, SORT_DESC, SORT_NUMERIC, $users);
+       $users = array_intersect_key($users, array_filter($order));
+}
+
+if (isset($Place['n'])) {
+       array_splice($users, $Place['n']);  # limit number of results
 }
 
 print '<ul';
 if (@$Place['view'] == 'avatar') {
        print ' class="gallery cat"';
 }
-else {
+elseif (count($users) > 5) {
        print ' class="cols"';
 }
 print ">\n";