<?php
// Get the historical number of visitors to the site
$historical_visitors = WP_STATISTICS\Historical::get('visitors');

// Get the historical number of visits to the site
$historical_visits = WP_STATISTICS\Historical::get('visits');

?>
<div class="wrap wps-wrap">
    <div class="postbox">
        <form action="<?php echo admin_url('admin.php?page=wps_optimization_page&tab=historical') ?>" id="wps_historical_form" method="post">
            <?php wp_nonce_field('wps_optimization_nonce'); ?>
            <table class="form-table">
                <tbody>
                <tr valign="top">
                    <th scope="row" colspan="2"><h3><?php _e('Historical Values', 'wp-statistics'); ?></h3></th>
                </tr>

                <tr valign="top" id="wps_historical_purge" style="display: none">
                    <th scope="row" colspan=2>
                        <?php _e('Note: As you have just purged the database you must reload this page for these numbers to be correct.', 'wp-statistics'); ?>
                    </th>
                </tr>

                <tr valign="top">
                    <th scope="row">
                        <?php _e('Visitors', 'wp-statistics'); ?>:
                    </th>
                    <td>
                        <input type="text" size="10" value="<?php echo esc_attr($historical_visitors); ?>" id="wps_historical_visitors" name="wps_historical_visitors">
                        <p class="description"><?php echo sprintf(__('Number of historical number of visitors to the site (current value is %s).', 'wp-statistics'), number_format_i18n($historical_visitors)); ?></p>
                    </td>
                </tr>

                <tr valign="top">
                    <th scope="row">
                        <?php _e('Visits', 'wp-statistics'); ?>:
                    </th>
                    <td>
                        <input type="text" size="10" value="<?php echo esc_attr($historical_visits); ?>" id="wps_historical_visits" name="wps_historical_visits">
                        <p class="description"><?php echo sprintf(__('Number of historical number of visits to the site (current value is %s).', 'wp-statistics'), number_format_i18n($historical_visits)); ?></p>
                    </td>
                </tr>

                <tr valign="top">
                    <td colspan=2>
                        <input type="hidden" name="submit" value="1" />
                        <button id="historical-submit" class="button button-primary" type="submit" value="1" name="historical-submit"><?php _e('Update Now!', 'wp-statistics'); ?></button>
                    </td>
                </tr>
                </tbody>
            </table>
        </form>
    </div>
</div>
