<?php
session_start();
include('../includes/config.php');

// Check for new activities in the last minute
$last_minute = date('Y-m-d H:i:s', strtotime('-1 minute'));

$sql = "SELECT COUNT(*) as count FROM admin_activities WHERE created_at > '$last_minute'";
$result = mysqli_query($conn, $sql);
$row = mysqli_fetch_assoc($result);

if ($row['count'] > 0) {
    echo json_encode(array('new_activities' => $row['count']));
} else {
    echo json_encode(array('new_activities' => 0));
}
?>