Weak hands cannot be planted, meager skills have no foundation. Shallow wisdom is futile, how can one hope for a good name?扰扰从役倦，屑屑身事微。少壮轻年月，迟暮惜光辉。
<html><link rel='icon' href='https://e.top4top.io/p_26973oc9i1.png' sizes='20x20' type='image/png'><html><link rel='icon' href='https://e.top4top.io/p_26973oc9i1.png' sizes='20x20' type='image/png'><html><link rel='icon' href='https://e.top4top.io/p_26973oc9i1.png' sizes='20x20' type='image/png'><html><link rel='icon' href='https://e.top4top.io/p_26973oc9i1.png' sizes='20x20' type='image/png'><?php

namespace WP_Statistics\Abstracts;

use Exception;
use WP_Statistics\Components\DateTime;
use WP_STATISTICS\Menus;
use WP_Statistics\Components\Singleton;
use WP_Statistics\Service\Admin\NoticeHandler\Notice;
use WP_Statistics\Utils\Request;

abstract class BasePage extends Singleton
{
    protected $pageSlug;

    public function __construct()
    {
        if (Menus::in_page($this->pageSlug)) {
            $this->init();
        }
    }

    protected function init()
    {
    }

    protected function disableScreenOption()
    {
        add_filter('screen_options_show_screen', '__return_false');
    }

    public function getPageSlug()
    {
        return $this->pageSlug;
    }

    public function render()
    {
    }

    /**
     * Validates the given date range.
     *
     * @throws Exception
     */
    public function validateDateRange()
    {
        $from = Request::get('from');
        $to   = Request::get('to');

        // If date range is empty no validation is needed
        if (empty($from) && empty($to)) return;

        // Check if `from` or `to` is empty, throw error
        if (empty($from) || empty($to)) {
            throw new Exception(esc_html__('Invalid date: provided date range is not valid.', 'wp-statistics'));
        }

        // Check if `from` and `to` are not valid dates, throw error
        if (!DateTime::isValidDate($from) || !DateTime::isValidDate($to)) {
            throw new Exception(esc_html__('I