It didn't state it outright in the novalization, but it did hint that Bruce spent at least five seasons (two winters) with the League of Shadows. So I think it would be something like five years of travelling, a few months in prison, another few months in another
prison, and over a year of training.
And yes, Bruce landed himself in two different prisons on two different occasions.
When he was caught giving a hand smuggling (his own) merchandise in the movie, he got send to his first prison. On the immediate next scene, he was actually going to his second prison.
Bruce got out of his first prison because he had some connections with the Chinese blackmarket (I think), but it ended up being a setup of some kind because the Chinese mob needed a few scapegoats for another mission. So Bruce ended up in another prison a few weeks after he got out of the first one (and stayed there...until Ra's).