Bayer Leverkusen thrashed Hertha Berlin 5-1 to secure a place in next season's Champions League on the final day of the Bundesliga.