diff --git a/core/logging_api.php b/core/logging_api.php index 08029b863b..6186eafc4d 100644 --- a/core/logging_api.php +++ b/core/logging_api.php @@ -148,6 +148,19 @@ function log_event( $p_level, $p_msg, $p_backtrace = null ) { function log_print_to_page() { if ( config_get_global( 'log_destination' ) === 'page' && auth_is_user_authenticated() && access_has_global_level( config_get( 'show_log_threshold' ) ) ) { global $g_log_events, $g_log_levels; + + $t_unique_queries_count = 0; + $t_total_query_execution_time = 0; + $t_unique_queries = array(); + $t_total_queries_count = 0; + $t_total_event_count = count( $g_log_events ); + + if( $t_total_event_count == 0 ) { + echo "\n\n"; + echo "\n\n"; + return; + } + echo "\n\n"; echo "
\n"; echo "\n"; @@ -161,18 +174,6 @@ function log_print_to_page() { echo "\t\n"; echo "\t\n"; - $t_unique_queries_count = 0; - $t_total_query_execution_time = 0; - $t_unique_queries = array(); - $t_total_queries_count = 0; - $t_total_event_count = count( $g_log_events ); - - if( $t_total_event_count == 0 ) { - echo "\t\n\t
\n"; - echo "\n\n"; - return; - } - for ( $i = 0; $i < $t_total_event_count; $i++ ) { if( $g_log_events[$i][1] == LOG_DATABASE ) { if( !in_array( $g_log_events[$i][2][0], $t_unique_queries ) ) {