diff --git a/airtime_mvc/application/models/Block.php b/airtime_mvc/application/models/Block.php index 5ff84a3d1..05459ee04 100644 --- a/airtime_mvc/application/models/Block.php +++ b/airtime_mvc/application/models/Block.php @@ -1211,6 +1211,7 @@ EOT; $insertList = array(); $totalTime = 0; + $totalItems = 0; // this moves the pointer to the first element in the collection $files->getFirst(); @@ -1220,7 +1221,9 @@ EOT; $length = Application_Common_DateHelper::calculateLengthInSeconds($iterator->current()->getDbLength()); $insertList[$id] = $length; $totalTime += $length; - if ( !is_null($limit['items']) && $limit['items'] == count($insertList)) { + $totalItems++; + + if ((!is_null($limit['items']) && $limit['items'] == count($insertList)) || $totalItems > 500) { break; }