The localization transition on the Bethe lattice