isLoggedIn() || !$auth->isAdmin()) { throw new Exception('Admin access required'); } $db = Database::getInstance(); // Reset analysis state $db->query("UPDATE optimization_analysis_state SET is_running = 0, processed_combinations = 0, completed_at = NULL WHERE id > 0"); // Reset all panel directives to unchecked state $db->query("UPDATE panel_directives SET llm_checked = 0, is_impossible = 0, llm_reasoning = NULL, status = 'pending' WHERE id > 0"); echo json_encode([ 'success' => true, 'message' => 'Analysis state reset successfully. You can now restart the analysis.' ]); } catch (Exception $e) { echo json_encode([ 'success' => false, 'message' => $e->getMessage() ]); } ?>