?>
</th>
					<th><?php 
_e('Size', 'wp-dbmanager');
?>
</th>
					<th><?php 
_e('Select', 'wp-dbmanager');
?>
</th>
				</tr>
			</thead>
			<?php 
$no = 0;
$totalsize = 0;
if (!is_emtpy_folder($backup['path'])) {
    if ($handle = opendir($backup['path'])) {
        $database_files = array();
        while (false !== ($file = readdir($handle))) {
            if ($file != '.' && $file != '..' && $file != '.htaccess' && (file_ext($file) == 'sql' || file_ext($file) == 'gz')) {
                $database_files[] = $file;
            }
        }
        closedir($handle);
        sort($database_files);
        for ($i = sizeof($database_files) - 1; $i > -1; $i--) {
            if ($no % 2 == 0) {
                $style = '';
            } else {
                $style = ' class="alternate"';
            }
function check_backup_files()
{
    $backup_options = get_option('dbmanager_options');
    $database_files = array();
    if (!is_emtpy_folder($backup_options['path'])) {
        if ($handle = opendir($backup_options['path'])) {
            while (false !== ($file = readdir($handle))) {
                if ($file != '.' && $file != '..' && (file_ext($file) == 'sql' || file_ext($file) == 'gz')) {
                    $database_files[] = $file;
                }
            }
            closedir($handle);
            sort($database_files);
        }
    }
    if (sizeof($database_files) >= $backup_options['max_backup']) {
        @unlink($backup_options['path'] . '/' . $database_files[0]);
    }
}