Visitor Log and actions broken

Have beem using 2.2 for years. All of a sudden (2 months after adjusting the DB purge settings) any new logs are ALSO displaying an old completely unrelated log action from my logs from 2014

In the first pic Action 2 shows the new action, pic 2 shows Action 1 is old - its actually from another site id also

Its been happening for 5 days. Even if I delete all of the last 5 days where these entries are shown and reprocess the same thing is happening. All new actions also show an old entry from Jan 30 2014

I have migrated the DB too a new installation and the same thing happens…

My guess is one of these tables is corrupted?

Is it possible to delete 5 days of data from the above tables?

This bug only shows up on the visitor log, always the first action

I found the bug is because piwik_log_link_visit_action.idvisit is been repeated!

thats a shocker -

the idvisit counter is now wrong -how can I adjust this too a higher number?