requireAuth(); $publication = new Publication(); $user = $auth->getUser(); // Handle actions $action = $_GET['action'] ?? ''; $message = ''; if ($action === 'delete' && isset($_GET['id'])) { $id = (int)$_GET['id']; try { $publication->delete($id); $message = 'Publication deleted successfully'; } catch (Exception $e) { $message = 'Error deleting publication: ' . $e->getMessage(); } } // Get statistics $stats = $publication->getStats(); // Get recent publications $recentPublications = $publication->getAll('all', 10); ?>