basePath = $basePath !== '' ? rtrim($basePath, '/') : __DIR__ . '/../../views'; } public function render(string $template, array $vars = []): string { $path = $this->basePath !== '' ? $this->basePath . '/' . ltrim($template, '/') : $template; if (!is_file($path)) { error_log('AC View missing: ' . $path); return ''; } if ($vars) { extract($vars, EXTR_SKIP); } ob_start(); require $path; $html = ob_get_clean() ?: ''; return $this->injectCsrfTokens($html); } private function injectCsrfTokens(string $html): string { if ($html === '' || stripos($html, '