prepare(" SELECT * FROM telegram_bot_interactions WHERE user_id = ? ORDER BY interaction_date DESC LIMIT 100 "); $stmt->execute([$selectedUser]); } else { $stmt = $pdo->query(" SELECT user_id, username, first_name, last_name, COUNT(*) as total_interactions, MAX(interaction_date) as last_interaction FROM telegram_bot_interactions GROUP BY user_id, username, first_name, last_name ORDER BY last_interaction DESC LIMIT 50 "); } $interactions = $stmt->fetchAll(); } catch (Exception $e) { $error = $e->getMessage(); } require_once __DIR__ . '/templates/header.php'; ?>
= htmlspecialchars($msg['interaction_type'] ?? '') ?>
= t('Selecciona un usuario para ver el historial') ?>