Here's how to keep it from happening a third time...
Measure your grow space. That's the space from the top of your pot/bucket to the bottom of your light at it's highest point. Subtract 12 inches (or 8 if your light is air-cooled). What's left the actual height your plant can grow to before potentially running into problems of being too tall for your space.
Now divide that actual height by 3. This is about as high as you can let a plant grow from the top of the pot before flipping, since most plants double or triple in height during flowering. If you know you have an indica that only doubles, then you can divide actual height by 2.
When choosing a strain to grow I always ask in the forum for the stretch from people who have grown the strain before. There are different phenotypes, so even this isn't 100%, but it gives me an idea whether to divide actual height by 2 or 3.
Good luck!