I don't think I made that clear enough, so I went back and reworded it to make it more explicit; the Animal companion's HP is determined like a PC, but using your ranger level instead of its CR.
So, for example, if you're a 3rd level ranger with a Wolf companion, it would have 3d8 +3, or 17 if...