How to keep records of past week visits in a web app?
The weekly_stats table can have one record for every week, i.e. something like:

CREATE TABLE weekly_stats (
  week_start date PRIMARY_KEY, -- e.g. '2018-03-05'
  article_id int unsigned,
  view_count int unsigned DEFAULT 0,
  CONSTRAINT week_stats_fk1 FOREIGN KEY (article_id) 
    REFERENCES `article` (`article_id`) ON DELETE CASCADE ON UPDATE CASCADE
);


Your application will then have update the weekly_stats.view_count every time an article is viewed. If the record for that particular week doesn't exist, the application will have to create it.

If you want to delete old data, which may not be necessary: Instead of a cron job, you could use a MariaDB event. Set it up to only delete records older than some limit, e.g. 365 days.