Fix history walks past the state ring buffer
Fixes #7340.
`syzygy_extend_pv` now walks the PV on a copy of the root position (`copy_state_infos`) and never undoes, so a line longer than `MAX_HIST` plies can't corrupt the root.
The repetition walks in `do_move`, `has_repeated` and `upcoming_repetition` run to `min(rule50, pliesFromNull)`, which can exceed `MAX_HIST` after 512 reversible plies (a long hand-pasted move history). Index 512 then wraps onto the current state. They are now clamped to `MAX_HIST - 1`.
closes https://github.com/official-stockfish/Stockfish/pull/7341
No functional change