diff --git a/src/Readers/IndexedLogReader.php b/src/Readers/IndexedLogReader.php index dac753e2..43f1008f 100644 --- a/src/Readers/IndexedLogReader.php +++ b/src/Readers/IndexedLogReader.php @@ -236,9 +236,9 @@ public function paginate(int $perPage = 25, ?int $page = null) { $page = $page ?: Paginator::resolveCurrentPage('page'); - if (! is_null($this->onlyShowIndex)) { + if (! is_null($this->onlyShowIndex) && $index = $this->reset()->getLogAtIndex($this->onlyShowIndex)) { return new LengthAwarePaginator( - [$this->reset()->getLogAtIndex($this->onlyShowIndex)], + [$index], 1, $perPage, $page @@ -291,7 +291,9 @@ public function percentScanned(): int protected function getLogAtIndex(int $index): ?Log { - $position = $this->index()->getPositionForIndex($index); + if (! $position = $this->index()->getPositionForIndex($index)) { + return null; + } $text = $this->getLogTextAtPosition($position);