File tree 3 files changed +11
-1
lines changed
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
10
10
11
11
- Support from JSON document (require RediSearch 2.2)
12
12
- (dev) GitHub Actions
13
+ - Protection against division by 0
13
14
14
15
### Fixed
15
16
16
17
- (dev) Code coverage with XDebug 3
17
18
- (dev) Defined list of allowed Composer plugins
19
+ - Fix ` PaginatedResponse ` index (now start at 0, and have a linear progression)
18
20
19
21
## [ 2.0.2]
20
22
Original file line number Diff line number Diff line change @@ -106,6 +106,10 @@ public function getPageSize(): int
106
106
107
107
public function getPageCount (): int
108
108
{
109
+ if (0 === $ this ->size ) {
110
+ return 0 ;
111
+ }
112
+
109
113
return (int ) ceil ($ this ->totalCount / $ this ->size );
110
114
}
111
115
Original file line number Diff line number Diff line change @@ -96,6 +96,10 @@ public function getPageSize(): int
96
96
97
97
public function getPageCount (): int
98
98
{
99
+ if (0 === $ this ->getPageSize ()) {
100
+ return 0 ;
101
+ }
102
+
99
103
return (int ) ceil ($ this ->totalCount / $ this ->getPageSize ());
100
104
}
101
105
@@ -105,7 +109,7 @@ public function key()
105
109
return 0 ;
106
110
}
107
111
108
- return (int ) ceil (($ this ->lastCommand ->getOffset () ?? 0 ) / $ this ->getPageSize ()) + 1 ;
112
+ return (int ) floor (($ this ->lastCommand ->getOffset () ?? 0 ) / $ this ->getPageSize ());
109
113
}
110
114
111
115
public function valid ()
You can’t perform that action at this time.
0 commit comments