File tree Expand file tree Collapse file tree 3 files changed +11
-1
lines changed Expand file tree Collapse file tree 3 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -10,11 +10,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
1111- Support from JSON document (require RediSearch 2.2)
1212- (dev) GitHub Actions
13+ - Protection against division by 0
1314
1415### Fixed
1516
1617- (dev) Code coverage with XDebug 3
1718- (dev) Defined list of allowed Composer plugins
19+ - Fix ` PaginatedResponse ` index (now start at 0, and have a linear progression)
1820
1921## [ 2.0.2]
2022
Original file line number Diff line number Diff line change @@ -106,6 +106,10 @@ public function getPageSize(): int
106106
107107 public function getPageCount (): int
108108 {
109+ if (0 === $ this ->size ) {
110+ return 0 ;
111+ }
112+
109113 return (int ) ceil ($ this ->totalCount / $ this ->size );
110114 }
111115
Original file line number Diff line number Diff line change @@ -96,6 +96,10 @@ public function getPageSize(): int
9696
9797 public function getPageCount (): int
9898 {
99+ if (0 === $ this ->getPageSize ()) {
100+ return 0 ;
101+ }
102+
99103 return (int ) ceil ($ this ->totalCount / $ this ->getPageSize ());
100104 }
101105
@@ -105,7 +109,7 @@ public function key()
105109 return 0 ;
106110 }
107111
108- return (int ) ceil (($ this ->lastCommand ->getOffset () ?? 0 ) / $ this ->getPageSize ()) + 1 ;
112+ return (int ) floor (($ this ->lastCommand ->getOffset () ?? 0 ) / $ this ->getPageSize ());
109113 }
110114
111115 public function valid ()
You can’t perform that action at this time.
0 commit comments