mirror of
https://github.com/processwire/processwire.git
synced 2025-08-13 10:15:28 +02:00
Minor fixes in WireArray, PaginatedArray and CommentStars classes
This commit is contained in:
@@ -291,7 +291,7 @@ class PaginatedArray extends WireArray implements WirePaginatable {
|
||||
|
||||
} else {
|
||||
|
||||
if($count > $limit) $count = $limit;
|
||||
if($limit && $count > $limit) $count = $limit;
|
||||
$end = $start + $count;
|
||||
if($end > $total) $total = $end;
|
||||
$start++; // make 1 based rather than 0 based...
|
||||
|
@@ -825,6 +825,7 @@ class WireArray extends Wire implements \IteratorAggregate, \ArrayAccess, \Count
|
||||
*/
|
||||
public function getRandom($num = 1, $alwaysArray = false) {
|
||||
$items = $this->makeNew();
|
||||
if($num < 1) return $items;
|
||||
$count = $this->count();
|
||||
if(!$count) {
|
||||
if($num == 1 && !$alwaysArray) return null;
|
||||
|
Reference in New Issue
Block a user