You are using that Query in a loop ... really not a good idea.
My suggestion:
Hook: admin_index_main
PHP Code:
if (can_access_logs($vbulletin->config['SpecialUsers']['canviewadminlog']))
{
print_table_break();
print_table_header($vbphrase['latest_admin_actions'], 7);
print_cells_row(array('<b>Log ID</b>', '<b>UserID</b>', '<b>Date</b>', '<b>Script</b>', '<b>Action</b>', '<b>Extra Info</b>', '<b>IP Address</b>',), 0, 0, -5, 'top', 1, 1);
$number_of_actions = 10; // Change this to the amount of admin actions you want shown.
$sql = "SELECT adminlog.*, user.username FROM " . TABLE_PREFIX . "adminlog
LEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = adminlog.userid)
ORDER BY adminlogid DESC LIMIT $number_of_actions";
$sqlr = $db->query($sql);
while($sr = $db->fetch_array($sqlr))
{
if (!$sr['extrainfo'])
{
$sr['extrainfo'] = 'N/A';
}
if (!$sr['action'])
{
$sr['action'] = 'None';
}
$sr['dateline'] = vbdate($vbulletin->options['logdateformat']);
print_cells_row(array($sr['adminlogid'], "<a href=\"user.php?do=edit&userid=$sr[userid]\">$sr[username]</a>", $sr['dateline'], $sr['script'], $sr['action'], $sr['extrainfo'], $sr['ipaddress'],), 0, 0, -5, 'top', 1, 1);
}
print_table_break();
}