(fix)wrong page array index value passed in during Group View pagination

The index value should be -1 since arrays start from 0. Otherwise, n+1-th page will be displayed when mouse clicked n-th page.
This commit is contained in:
Morgan Wong
2019-04-25 00:58:04 +08:00
committed by GitHub
parent f6049ce88d
commit 367202603a
+4 -4
View File
@@ -661,8 +661,8 @@ class TorrentController extends Controller
$hungry = array_chunk($prelauncher, $qty);
$fed = [];
if (is_array($hungry) && array_key_exists($page, $hungry)) {
$fed = $hungry[$page];
if (is_array($hungry) && array_key_exists($page-1, $hungry)) {
$fed = $hungry[$page-1];
}
$totals = [];
$counts = [];
@@ -725,8 +725,8 @@ class TorrentController extends Controller
$hungry = array_chunk($prelauncher, $qty);
$fed = [];
if (is_array($hungry) && array_key_exists($page, $hungry)) {
$fed = $hungry[$page];
if (is_array($hungry) && array_key_exists($page-1, $hungry)) {
$fed = $hungry[$page-1];
}
$torrents = Torrent::with(['user', 'category'])->withCount(['thanks', 'comments'])->whereIn('id', $fed)->orderBy($sorting, $order)->get();
} else {