function get_item_description($activity)
{
    global $dbh;
    global $settings;
    if ($activity['type'] == 'backed up') {
        ?>
<a href="<?php 
        echo $activity['table'];
        ?>
" target="_blank">File</a> - <?php 
        echo byte_convert($activity['row']);
        echo file_exists($activity['table']) ? '' : ' - <span class="warning">Missing File!</span>';
    } elseif ($activity['type'] == 'error') {
        $view_error = true ? ellipses($activity['sql']) : $activity['sql'];
        return '<a href="#" class="dialog_note" title="Error Detail" message="<b>User:</b> ' . get_username($activity['user']) . '<br><b>Page:</b> ' . $activity['table'] . '<br><b>Time:</b> ' . date('M jS Y, g:i:s a', strtotime($activity['datetime'])) . '<br><br>' . str_replace('"', '\\"', strip_tags($activity['sql'])) . '">View Error</a>: ' . $view_error;
    } elseif ($activity['type'] == 'installed') {
        return 'Directus install';
    } elseif ($activity['table'] == 'directus_users') {
        return '<a href="users.php">' . $activity['sql'] . '</a> has been added to Directus Users';
    } elseif ($activity['table'] == 'directus_media') {
        // Get name of media
        $sth = $dbh->prepare("SELECT * FROM `directus_media` WHERE `id` = :id ");
        $sth->bindParam(':id', $activity['row']);
        $sth->execute();
        if ($row = $sth->fetch()) {
            $title = $row['title'];
        }
        $title = $title ? ellipses($title, 20) : '<i>No title</i>';
        $return = '<a href="#" class="open_media" media_id="' . $activity['row'] . '">' . $title . '</a> within Directus Media';
        $return .= $activity['sql'] == 'batch' ? ' - <b>Batch upload</b>' : '';
        return $return;
    } elseif ($activity['table'] && $activity['row']) {
        $first_field = get_primary_field_value($activity['table'], $activity['row']);
        return '<a href="edit.php?table=' . $activity['table'] . '&item=' . $activity['row'] . '" title="' . ellipses(str_replace('"', '\\"', $first_field), 200) . '">' . ellipses($first_field, 20) . '</a> within ' . uc_table($activity['table']);
    }
}
function item_message_subject($table, $row)
{
    return uc_table($table) . " Item: " . get_primary_field_value($table, $row);
}