PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, PDO::ATTR_EMULATE_PREPARES => false ] ); } catch (PDOException $e) { error_log("Panel database connection failed: " . $e->getMessage()); throw new Exception('Panel database connection failed: ' . $e->getMessage()); } } return $panelPdo; } // Also check if profiler tables exist function hasProfilerTables() { static $hasTables = null; if ($hasTables === null) { try { $pdo = getPanelDBConnection(); $stmt = $pdo->query("SHOW TABLES LIKE 'profiler_questions'"); $hasTables = ($stmt->rowCount() > 0); } catch (Exception $e) { $hasTables = false; } } return $hasTables; }