Welcome to UB.
Not a bad first car to be honest. It will need work to keep it running for sure, but properly cared for their pretty decent cars. My E36 has higher milage then that thing.
I would have all the fluids replaced, then all the filters (air, fuel, cabin air, transmission). Depending on how long the car sat for anything made of rubber may have deteriorated. I would have all the vaccum lines inspected for leaks.
The reason it failed smog could be because the catalytic converter has failed and may need replacement.