diff --git a/public/index.php b/public/index.php
index 03fae53..8ac8a0c 100644
--- a/public/index.php
+++ b/public/index.php
@@ -53,6 +53,8 @@ $content = $l['handler'](...$l['params'] ?? []);
if (is_htmx()) {
$content .= '
'.page_title().'';
$content .= Render\debug_db_info();
+ if (env('debug', false)) $content .= Render\debug_query_log();
+
if ($GLOBALS['state']['user-state-changed'] ?? false) {
$content .= Render\right_nav();
}
diff --git a/src/render.php b/src/render.php
index 09a675d..a4aff8f 100644
--- a/src/render.php
+++ b/src/render.php
@@ -43,3 +43,14 @@ function babblebox(): string
{
return render('babblebox', ['messages' => babblebox_messages()]);
}
+
+function debug_query_log(): string
+{
+ $html = '';
+ foreach (db()->log as $record) {
+ $query_string = str_replace(["\r\n", "\n", "\r"], ' ', $record[0]);
+ $error_string = !empty($record[2]) ? '// '.$record[2] : '';
+ $html .= '['.round($record[1], 2)."s] {$query_string}{$error_string}
";
+ }
+ return $html . '
';
+}
diff --git a/templates/layouts/primary.php b/templates/layouts/primary.php
index 9778832..cfe7be5 100644
--- a/templates/layouts/primary.php
+++ b/templates/layouts/primary.php
@@ -40,27 +40,7 @@
Version = VERSION ?> = BUILD ?>
- ';
- foreach (db()->log as $record) {
- $query_string = str_replace(["\r\n", "\n", "\r"], ' ', $record[0]);
- $error_string = !empty($record[2]) ? '// '.$record[2] : '';
- echo '['.round($record[1], 2)."s] {$query_string}{$error_string}
";
- }
- echo '';
- }
- ?>
+
-
-