Hampshire County Council has spent more than £4m on compensation for public liability claims between 2020 and 2024, new figures show.