<?php
require_once __DIR__ . '/../config/config.php';
try {
    $db = Database::getInstance();
    $rows = $db->fetchAll('SELECT * FROM conversations ORDER BY created_at DESC LIMIT 5');
    echo json_encode($rows, JSON_PRETTY_PRINT);
} catch (Throwable $t) {
    echo "Error: " . $t->getMessage() . "\n";
}
