MDL-44345 repository_youtube: Endless loop when reaching last results

This commit is contained in:
Frederic Massart 2014-03-05 16:58:13 +08:00
parent 76e4de31cc
commit eaafde6ec0

View File

@ -89,7 +89,8 @@ class repository_youtube extends repository {
$ret['list'] = $this->_get_collection($search_text, $start, $max, $sort);
$ret['norefresh'] = true;
$ret['nosearch'] = true;
$ret['pages'] = -1;
// If the number of results is smaller than $max, it means we reached the last page.
$ret['pages'] = (count($ret['list']) < $max) ? $ret['page'] : -1;
return $ret;
}