static function recursive_file_search($pattern = '*', $flags = 0, $path = '')
 {
     $paths = glob($path . '*', GLOB_MARK | GLOB_ONLYDIR | GLOB_NOSORT);
     if ($paths === FALSE) {
         return FALSE;
     }
     $files = glob($path . $pattern, $flags);
     if ($files === FALSE) {
         return FALSE;
     }
     foreach ($paths as $path) {
         $files = array_merge($files, AIOWPSecurity_Utility_File::recursive_file_search($pattern, $flags, $path));
     }
     return $files;
 }
    function render_tab4()
    {
        global $aio_wp_security;
        if (isset($_POST['aiowps_system_log_file'])) {
            if ($_POST['aiowps_system_log_file'] != NULL) {
                $sys_log_file = sanitize_text_field($_POST['aiowps_system_log_file']);
                $aio_wp_security->configs->set_value('aiowps_system_log_file', $sys_log_file);
            } else {
                $sys_log_file = 'error_log';
                $aio_wp_security->configs->set_value('aiowps_system_log_file', $sys_log_file);
            }
            $aio_wp_security->configs->save_config();
        } else {
            $sys_log_file = $aio_wp_security->configs->get_value('aiowps_system_log_file');
        }
        ?>
        <h2><?php 
        _e('System Logs', 'aiowpsecurity');
        ?>
</h2>
        <div class="aio_blue_box">
            <?php 
        echo '<p>' . __('Sometimes your hosting platform will produce error or warning logs in a file called "error_log".', 'aiowpsecurity') . '
            <br />' . __('Depending on the nature and cause of the error or warning, your hosting server can create multiple instances of this file in numerous directory locations of your WordPress installation.', 'aiowpsecurity') . '
            <br />' . __('By occassionally viewing the contents of these logs files you can keep informed of any underlying problems on your system which you might need to address.', 'aiowpsecurity') . '
            </p>';
        ?>
        </div>

        <div class="postbox">
        <h3><label for="title"><?php 
        _e('View System Logs', 'aiowpsecurity');
        ?>
</label></h3>
        <div class="inside">
            <p>Please click the button below to view the latest system logs:</p>
            <form action="" method="POST">
                <?php 
        wp_nonce_field('aiowpsec-view-system-logs-nonce');
        ?>
                <div><?php 
        _e('Enter System Log File Name', 'aiowpsecurity');
        ?>
:
                <input type="text" size="25" name="aiowps_system_log_file" value="<?php 
        echo sanitize_text_field($sys_log_file);
        ?>
" />
                <span class="description"><?php 
        _e('Enter your system log file name. (Defaults to error_log)', 'aiowpsecurity');
        ?>
</span>
                </div>
                <div class="aio_spacer_15"></div>
                <input type="submit" name="aiowps_search_error_files" value="<?php 
        _e('View Latest System Logs', 'aiowpsecurity');
        ?>
" class="button-primary search-error-files" />
                <span class="aiowps_loading_1">
                    <img src="<?php 
        echo AIO_WP_SECURITY_URL . '/images/loading.gif';
        ?>
" alt="<?php 
        __('Loading...', 'aiowpsecurity');
        ?>
" />
                </span>            
            </form>
        </div></div>
    <?php 
        if (isset($_POST['aiowps_search_error_files'])) {
            $nonce = $_REQUEST['_wpnonce'];
            if (!wp_verify_nonce($nonce, 'aiowpsec-view-system-logs-nonce')) {
                $aio_wp_security->debug_logger->log_debug("Nonce check failed on view system log operation!", 4);
                die("Nonce check failed on view system log operation!");
            }
            $logResults = AIOWPSecurity_Utility_File::recursive_file_search($sys_log_file, 0, ABSPATH);
            if (empty($logResults) || $logResults == NULL || $logResults == '' || $logResults === FALSE) {
                $this->show_msg_updated(__('No system logs were found!', 'aiowpsecurity'));
            } else {
                foreach ($logResults as $file) {
                    $this->display_system_logs_in_table($file);
                }
            }
        }
    }