@@ -616,11 +616,11 @@ protected function setDefaults(): self
616616 'userId ' => null ,
617617 'username ' => '' ,
618618 'ajax ' => $ this ->request ->isAJAX (),
619+ 'search ' => $ this ->request ->getVar ('search ' ),
619620 'sort ' => $ this ->getSort (),
620621 'order ' => $ this ->getOrder (),
621622 'format ' => $ this ->getFormat (),
622- 'search ' => $ this ->request ->getVar ('search ' ),
623- 'perPage ' => service ('settings ' )->perPage ,
623+ 'perPage ' => $ this ->getPerPage (),
624624 'page ' => $ this ->request ->getVar ('page ' ),
625625 'pager ' => null ,
626626 'access ' => $ this ->model ->mayAdmin () ? 'manage ' : 'display ' ,
@@ -685,6 +685,33 @@ protected function getOrder(): string
685685 return 'asc ' ;
686686 }
687687
688+ /**
689+ * Determines items per page.
690+ *
691+ * @return int
692+ */
693+ protected function getPerPage (): int
694+ {
695+ // Check for a request, then load from Settings
696+ $ nums = [
697+ $ this ->request ->getVar ('perPage ' ),
698+ service ('settings ' )->perPage ,
699+ ];
700+
701+ foreach ($ nums as $ num )
702+ {
703+ // Validate
704+ if (is_numeric ($ num ) && (int ) $ num > 0 )
705+ {
706+ // Update user setting with the new preference
707+ service ('settings ' )->perPage = $ num ;
708+ return $ num ;
709+ }
710+ }
711+
712+ return 10 ;
713+ }
714+
688715 /**
689716 * Determines the display format.
690717 *
0 commit comments