diff --git a/inc/template.php b/inc/template.php index d9e1c386..378f36d0 100644 --- a/inc/template.php +++ b/inc/template.php @@ -45,21 +45,23 @@ function Element($templateFile, array $options) { } if (isset($options['body']) && $config['debug']) { + $_debug = $debug; + if (isset($debug['start'])) { - $debug['time']['total'] = '~' . round((microtime(true) - $debug['start']) * 1000, 2) . 'ms'; - $debug['time']['init'] = '~' . round(($debug['start_debug'] - $debug['start']) * 1000, 2) . 'ms'; - unset($debug['start']); - unset($debug['start_debug']); + $_debug['time']['total'] = '~' . round((microtime(true) - $_debug['start']) * 1000, 2) . 'ms'; + $_debug['time']['init'] = '~' . round(($_debug['start_debug'] - $_debug['start']) * 1000, 2) . 'ms'; + unset($_debug['start']); + unset($_debug['start_debug']); } if ($config['try_smarter'] && isset($build_pages) && !empty($build_pages)) - $debug['build_pages'] = $build_pages; - $debug['included'] = get_included_files(); - $debug['memory'] = round(memory_get_usage(true) / (1024 * 1024), 2) . ' MiB'; - $debug['time']['db_queries'] = '~' . round($debug['time']['db_queries'] * 1000, 2) . 'ms'; - $debug['time']['exec'] = '~' . round($debug['time']['exec'] * 1000, 2) . 'ms'; + $_debug['build_pages'] = $build_pages; + $_debug['included'] = get_included_files(); + $_debug['memory'] = round(memory_get_usage(true) / (1024 * 1024), 2) . ' MiB'; + $_debug['time']['db_queries'] = '~' . round($_debug['time']['db_queries'] * 1000, 2) . 'ms'; + $_debug['time']['exec'] = '~' . round($_debug['time']['exec'] * 1000, 2) . 'ms'; $options['body'] .= '

Debug

' .
-				str_replace("\n", '
', utf8tohtml(print_r($debug, true))) . + str_replace("\n", '
', utf8tohtml(print_r($_debug, true))) . '
'; }