static function parachute(&$count, $max = '', $redirect = '', $log = false, $alert = false) { $max = DevValue::isNotNull($rcpt) ? $max : 400; if ($count >= $max) { $status = "Loop exceeded max count! Killing Process.\n"; if ($alert) { Util::emailAdmin($status); } if ($log) { $logger = Log::instance(array('storage' => 'log')); $logger->push($status); $logger->write(); } if (DevValue::isNotNull($redirect)) { HTTP::redirect($redirect, array('msg' => $status)); } else { exit("A script on this page began to loop out of control. Process has been killed. If you are viewing this message, please alert the administrator.\n"); } } $count++; }